package org.android.bbox;

import java.util.Comparator;

public class Menu
{
	private int id;
	private String label;

	public Menu(int id, String label)
	{
		this.id = id;
		this.label = label;
	}

	public String getLabel()
	{
		return this.label;
	}

	public int getId()
	{
		return this.id;
	}

	public static Menu[] factory(String[] menus)
	{
		Menu[] menu = new Menu[menus.length];
		for(int i = 0; i < menus.length; i++)
		{
			menu[ i ] = new Menu(i, menus[ i ]);
		}
		return menu;
	}

	public static Comparator<Menu> getComparator()
	{
		return new Comparator<Menu>(){
			@Override
			public int compare(Menu m1, Menu m2)
			{
				return m1.getLabel().compareTo(m2.getLabel());
			}
		};
	}

	public String toString()
	{
		return this.getLabel();
	}
}
